<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of surveyconfim
 *
 * @author cuonghero
 */
class surveyconfim {
    public function __construct() {

        parent::__construct();

        // loads the survey model
        $this->load->model('surveymodel');
    }
    public function index() {
       $this->load->view('survey_confim');
       
    }
    public function addSurveyFormSubmission() {
        
        $params['created'] = $this->input->post('created');
        $params['idsp1'] = $this->input->post('idsp1');
        $params['idsp2'] = $this->input->post('idsp2');
        $params['courses'] = $this->input->post('courses');
        $params['name'] = $this->input->post('name');
        $params['namekana'] = $this->input->post('namekana');
        $params['workplace'] = $this->input->post('workplace');
        $params['department'] = $this->input->post('department');
        $params['email'] = $this->input->post('email');
        $params['zip'] = $this->input->post('zip');
        $params['state'] = $this->input->post('state');
        $params['city'] = $this->input->post('city');
        $params['address'] = $this->input->post('address');
        $params['gender'] = $this->input->post('gender');
        $params['phonenumber'] = $this->input->post('phonenumber');
        $params['supplier'] = $this->input->post('supplier');
        $params['idsurvey'] = $this->input->post('idsurvey');
        $params['q1'] = $this->input->post('q1');
        $params['q2'] = $this->input->post('q2');
        $params['q3'] = $this->input->post('q3');
        $params['q4'] = $this->input->post('q4');
        $params['q5'] = $this->input->post('q5');
        $params['q6'] = $this->input->post('q6');
        $params['q7'] = $this->input->post('q7');
        $params['q8'] = $this->input->post('q8');
        $params['q9'] = $this->input->post('q9');
        $params['q10'] = $this->input->post('q10');

        $addSurvey = $this->surveyModel->insertSurvey($params);

        if ($addSurvey) {
            $this->session->set_flashdata('success_msg', 'Your category has been added successfully');
            redirect('survey_view');
        } else {
            $this->session->set_flashdata('error_msg', 'Please try again adding a category');
            redirect('survey/addSurveyFormSubmission');
        }
    }
}
